package com.wty.design.creational.singleton;

/**
 * @Author wangtengyu
 * @Create 2018-09-18-14:59
 */
public class StaticInnerClassSingleton {

    private static class InnerClass {
        private static StaticInnerClassSingleton instance=new StaticInnerClassSingleton();
    }

    public static StaticInnerClassSingleton getInstance(){
        return InnerClass.instance;
    }
    private StaticInnerClassSingleton(){
        if (InnerClass.instance!=null){
            throw new RuntimeException("单例构造器禁止反射");
        }
    }
}
